#ifndef SMSSERVICEENGINER_H
#define SMSSERVICEENGINER_H

#include "SmsServiceIPC.h"
#include "SmsMessageSend.h"
#include "SmsEngine.h"
#include "JsonObject.h"
#include "ClientEngine.h"

const   TUid    KIpcProPropertyUid={0xE340551F};
#define KShareAddr _L("SMS_SERVICE_ADDR")
#define KNotifyBaseAddr _L8("http://218.16.118.166:8082/newmobile/GetPortServlet?")
//#define KNotifyBaseAddr _L8("http://51soji.gicp.net:8082/newmobile/GetPortServlet?")
_LIT8(KMimeType, "text/plain");

typedef struct tag_ProcessContext
{
    
} ProcessContext;

class CSmsServiceEnginer:public MSmsServiceIPCObserver,public MSMSEngineObserver,public MClientObserver
{
private:
    CSmsServiceEnginer();
    virtual ~CSmsServiceEnginer();
    void StartSend();
    HBufC* ReplaceL(const TDesC8& aSource, const TDesC& aOldChar,const TDesC& aNewChar);
    TBool FindFilterKeyWord(const TDesC& aSource,TInt& aPos);
    void HandleServerReponse( CJsonObject *aJsonObj);
private:
    static CSmsServiceEnginer *iInstance;
    CSmsServiceIPC *iIpc;
    CSmsMessageSend *iSmsSend;
    CJsonObject *iJsonObj;
    CSMSEngine *iSmsRecv;
    CClientEngine *iHttpClient; 
    HBufC8 *iNotifyUrl;
    HBufC8 *iImeiNum;
    int iIap;
    TBool iSuccessed;
    
public:
    static CSmsServiceEnginer *GetInstance();
    static void Destroy();
    void Start();
    void IntPropertyUpdatedL( TInt aValue);
    TBool HandleRecvMessageL(const TDesC& aAddr, const TDesC& aContent);
    void ClientBodyReceived(TInt aError,const TDesC8& aBodyData,TInt aAction);
};

#endif

